﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MMDemo
{
    /// <summary>
    /// 当执行完时，委托去修改菜单
    /// </summary>
    public delegate void ChangeMenuFromExcuteOver();
    class Delegate
    {
        private Form parent;
        private ChangeMenuFromExcuteOver change;
        public Delegate(Form parent, ChangeMenuFromExcuteOver change)
        {
            this.parent = parent;
            this.change = change;
        }
        public void ChangeMenu()
        {
            try
            {
                parent.Invoke(change);
            }
            catch
            {
                MessageBox.Show(parent,"修改菜单失败");
            }
        }
    }
}
